﻿namespace ColorWheel.Win.Wheel.Demo
{
    using System.Windows;
    using ColorWheel.Core;
    using System.Windows.Media;
    using System.ComponentModel;
    using System.Windows.Data;

    public partial class MainWindow: Window, INotifyPropertyChanged
    {
        public Palette                                  m_palette;
        public event PropertyChangedEventHandler        PropertyChanged;

        public MainWindow(
        )
        {
            InitializeComponent();

            DataContext = this;
            Palette     = Palette.Create(new RGBColorWheel(), Colors.BlueViolet, PaletteSchemaType.Complementary, 10);
        }

        private void FirePropertyChanged(
            string                                      name
        )
        {
            if(PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }

        public Palette Palette
        {
            get
            {
                return m_palette;
            }
            set
            {
                m_palette = value;
                FirePropertyChanged("Palette");
            }
        }

        private void button1_Click(
            object                                      sender, 
            RoutedEventArgs                             e
        )
        {
            Palette.Wheel = new RGBColorWheel();
        }

        private void button2_Click(
            object                                      sender, 
            RoutedEventArgs                             e
        )
        {
            Palette.Wheel = new RYBColorWheel();
        }

        private void button3_Click(
            object                                      sender, 
            RoutedEventArgs                             e
        )
        {
            Palette.Wheel = new RYGBColorWheel();
        }
    }
}
